<?php

require '/classes/Connection.class.php';

$conn = new CONNECTION();

$q = mysql_real_escape_string($_GET['q']);

$sqlCar = "SELECT * FROM Car where locate('$q',plaque) > 0 order by locate('$q',plaque) limit 50";

$resCar = mysql_query($sqlCar);

while ($campo = mysql_fetch_array($resCar)) {
    $id = $campo['id'];
    $license = $campo['plaque'];
    $year = $campo['year'];
    $model = $campo['model'];
    $color = $campo ['color'];
    $mark = $campo['mark'];
    $license = addslashes($license);
    $html = preg_replace("/(" . $q . ")/i", "<span style=\"font-weight:bold\">\$1</span>", $license);
    echo "<li onselect=\"this.setText('$license').setValue('$model','$color','$year','$id','$mark');\">$html ($mark)($model)($year)</li>\n";
}
?>